﻿using Pattern16策略模式.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern16策略模式.Models
{
    /// <summary>
    /// 折扣收费
    /// </summary>
    public class RebatePay : PayBase
    {
        private double rebate = 1;

        public RebatePay(double rebate)
        {
            if(rebate < 0 || rebate > 1)
            {
                throw new ArgumentException("折扣在0-1之间");
            }

            this.rebate = rebate;
        }

        public override double Calc(double money)
        {
            return money * rebate;
        }
    }
}
